<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>图片压缩</title>
<jsp:include page="../../public/header.jsp"/>
<script type="text/javascript" src="http://res.easywan.info/public/static/js/html2canvas.svg.min.js"></script>
<script type="text/javascript" src="http://res.easywan.info/public/static/js/html2canvas.min.js"></script>
</head>
<body>
	<jsp:include page="../../public/nav.jsp"/>
	<div class="row">
		
		<div class="col-xs-10 col-xs-offset-1" style="margin-top: 20px">
		<form action="" class="form-horizontal">
		<div class="form-group col-sm-3">
		 	<label class="col-sm-4 control-label" for="sel">线路</label>
		 	 <div class="col-sm-8">
			<select class="form-control" id="sel"></select>
			 </div>
		</div>
		<div class="form-group col-sm-6">
		    <label class="col-sm-2 control-label" for="url">视频地址:</label>
		     <div class="col-sm-10">
		    <input type="text" class="form-control" id="url" placeholder="">
		    </div>
		</div>
		
		</form>
		<button id="start" class="btn btn-default">播放</button>
		<!-- <div  class="form-group col-sm-6" >
			 <button id="cut" class="btn btn-default">截图</button>
		</div> -->
		
		</div>
		
	</div>
	<iframe id="player" src="/image/videoCuteWelcome.html" width="100%" frameborder="no" border="0"  scrolling="no" >
		</iframe>
	
	<jsp:include page="../../public/footer.jsp"/>
	<jsp:include page="../../public/footer2.jsp"/>
</body>
	<script type="text/javascript">
	//document.domain = "easywan.info";
	 function setIframeHeight(iframe) {
	 if (iframe) {
	 var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
	 if (iframeWin.document.body) {
	 iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight ;
	 iframe.height= Number(iframe.height)+400;
	 //console.log(iframe.height);
	 }
	 }
	 };

	 $(function () {
	 setIframeHeight(document.getElementById('player'));
	 });
	 
		console.log("load");
		var data = [
		{name:"线路1",url:"https://api.47ks.com/webcloud/?v="},
		{name:"线路2",url:"http://api.mp4la.net/?url="},
		{name:"线路3",url:"http://v.72du.com/api/?url="},
		{name:"线路4",url:"http://api.47ks.com/webcloud/?v="},
		{name:"线路5",url:"http://jx.71ki.com/index.php?url="},
		{name:"线路6",url:"http://000o.cc/jx/ty.php?url="},
		{name:"线路7",url:"http://www.yydy8.com/Common/?url="},
		{name:"线路8",url:"http://yun.mt2t.com/yun?url="},
		{name:"线路9",url:"http://api.mp4la.net/?url="},
		{name:"线路10",url:"http://yyygwz.com/index.php?url="},
		{name:"线路11",url:"http://v.72du.com/api/?url="},
		{name:"线路12",url:"http://api.47ks.com/webcloud/?v="},
		{name:"线路13",url:"http://jx.71ki.com/index.php?url="},
		{name:"线路14",url:"http://www.97zxkan.com/jiexi/97zxkanapi.php?url="},
		{name:"线路15",url:"http://www.wmxz.wang/video.php?url="},
		{name:"线路16",url:"http://www.bbshanxiucao.top/video.php?url="},
		{name:"线路17",url:"http://www.xiguaso.com/api/index.php?url="},
		{name:"线路18",url:"http://www.kppev.cn/jiexi/5/1/1.php?url="},
		{name:"线路19",url:"http://api.mp4la.net/?url="},
		{name:"线路20",url:"http://v.72du.com/api/?url="},
		{name:"线路21",url:"http://api.47ks.com/webcloud/?v="},
		{name:"线路22",url:"http://jx.71ki.com/index.php?url="},
		{name:"线路23",url:"http://000o.cc/jx/ty.php?url="},
		{name:"线路24",url:"http://5qiyi.sdyhy.cn/5qiyi/5qiyi2.php?url="},
		{name:"线路25",url:"http://vip.sdyhy.cn/ckflv/?url="},
		{name:"线路26",url:"http://player.gakui.top/?url="},
		{name:"线路27",url:"http://qtzr.net/s/?qt="},
		{name:"乐视",url:"http://apn.zhibo99.cn/mdparse/letv.php?id="},
		{name:"优酷1",url:"http://api.baiyug.cn/vip/index.php?url="},
		{name:"优酷2",url:"http://977345961.kezi.wang/ykyun/c.php?vid="},
		];
		for (var i in  data)
		{
			var opt = document.createElement ("option");
			console.log(data[i]);
			opt.value = data[i].url;
			opt.innerText = data[i].name;
			console.log(opt);
			document.getElementById('sel').appendChild(opt);
		}
		
		$("#start").click(function(){
			var api = $("#sel").val();
			var url = $("#url").val();
			var playerUrl = api + url;
			$("#player").attr("src",playerUrl);
		})
		$("#cut").click(function(){
			console.log(document.body);
			//console.log(document.iframe);
			console.log($("#player")[0]);
			console.log($(window.frames["player"].document).find('div'));
			//console.log($("#player").find("html").firstChild())
			console.log($('#player').contents())
			html2canvas($("#player").find('html')[0], {
				  onrendered: function(canvas) {
				    document.getElementById("img").appendChild(canvas);
				  }
				});
		});
	</script>
</html>